/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.homesoft.catalogman.gui;

import com.homesoft.catalogman.dao.HmObjectMetaDAO;
import com.homesoft.catalogman.entity.HmObjectMeta;
import com.homesoft.catalogman.entity.HmTaxonomy;
import java.awt.BorderLayout;
import static java.awt.BorderLayout.LINE_START;
import static java.awt.BorderLayout.NORTH;
import java.awt.Checkbox;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.TextArea;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javafx.scene.control.ComboBox;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import net.miginfocom.swing.MigLayout;
import org.jdesktop.swingx.JXImageView;
import org.jdesktop.swingx.JXTitledPanel;

/**
 *
 * @author Thai Bao Nguyen
 */
public class ObjectMeta_03 extends CustomPanel {

    JLabel[] groupName = new JLabel[100];
    private HmObjectMeta hmobjectmeta;
    private HmObjectMetaDAO hmobjectmetadao;
    private HmTaxonomy hmtaxonomy;
    private Object object;
    private int i = 0;
    int selected = 0;
    private GridBagConstraints c = new GridBagConstraints();
    JPanel[] jpanelOption = new JPanel[100];
    JPanel jpaneltemp = new JPanel(new MigLayout());

    JCheckBox[][] chkbox = new JCheckBox[100][100];
    JLabel[][] lb = new JLabel[100][100];
    TextField[][] txtString = new TextField[100][100];

    int containercount = 4;
    int selectedPanel = 0;
    int groupcount = 0;
    int componentcounter = 0;
    //[j][i]
    int locateArrayI;
    int locateArrayJ;
    JPanel[] jpanelGroup = new JPanel[100];
    JSeparator separator;

    /**
     * Creates new form ObjectMeta
     */
    public ObjectMeta_03() {
        initComponents();
        jPanel3nen.setLayout(new MigLayout());

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        btnAddField = new javax.swing.JButton();
        btnAddGroup = new javax.swing.JButton();
        btnMoveUp = new javax.swing.JButton();
        btnMoveDown = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jPanel3nen = new javax.swing.JPanel();

        jPanel1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 204, 204), 1, true));

        btnAddField.setLabel("+ Add field");
        btnAddField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddFieldActionPerformed(evt);
            }
        });

        btnAddGroup.setLabel("+ Add group");
        btnAddGroup.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddGroupActionPerformed(evt);
            }
        });

        btnMoveUp.setLabel("Move up");
        btnMoveUp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMoveUpActionPerformed(evt);
            }
        });

        btnMoveDown.setLabel("Move down");
        btnMoveDown.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMoveDownActionPerformed(evt);
            }
        });

        jButton5.setLabel("<< OK");

        jPanel3nen.setLayout(new java.awt.BorderLayout());
        jScrollPane1.setViewportView(jPanel3nen);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(btnAddField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnAddGroup, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)
                    .addComponent(btnMoveUp, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)
                    .addComponent(btnMoveDown, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)
                    .addComponent(jButton5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(38, 38, 38)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 394, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(24, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane1)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(btnAddField, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(8, 8, 8)
                        .addComponent(btnAddGroup, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(126, 126, 126)
                        .addComponent(btnMoveUp, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(8, 8, 8)
                        .addComponent(btnMoveDown, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 123, Short.MAX_VALUE)
                        .addComponent(jButton5)))
                .addGap(76, 76, 76))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(3, 3, 3))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    private void btnAddFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddFieldActionPerformed
        // TODO add your handling code here:
        //i=0;
        CustomDialog dlg = new CustomDialog(new DefineField_04(), null, true);
        dlg.show(null);
        hmobjectmeta = (HmObjectMeta) dlg.getFormData();
        i = hmobjectmeta.getDataType();
        setControlPanel(i);
    }//GEN-LAST:event_btnAddFieldActionPerformed

    private void btnMoveUpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMoveUpActionPerformed
        // TODO add your handling code here:
        containercount = jPanel3nen.getComponentCount();
        int locate;
            String wrap = null;
            System.out.println("Selected Panel " + selectedPanel);
            jpaneltemp.removeAll();
            locate = 0;
            while (jpanelOption[selectedPanel].getComponentCount() > 0) {
                if (locate == 1 || locate == 3) {
                    wrap = "wrap";
                } else {
                    if (locate == 2) {
                        wrap = "skip";
                    } else {
                        if (locate == 0) {
                            wrap = "";
                        }
                    }
                }
                jpaneltemp.add(jpanelOption[selectedPanel].getComponent(0), wrap);
                locate++;
            }

            locate = 0;
            while (jpanelOption[selectedPanel - 1].getComponentCount() > 0) {
                if (locate == 1 || locate == 3) {
                    wrap = "wrap";
                } else {
                    if (locate == 2) {
                        wrap = "skip";
                    } else {
                        if (locate == 0) {
                            wrap = "";
                        }
                    }
                }
                jpanelOption[selectedPanel].add(jpanelOption[selectedPanel - 1].getComponent(0), wrap);
                locate++;
            }

            locate = 0;
            while (jpaneltemp.getComponentCount() > 0) {
                if (locate == 1 || locate == 3) {
                    wrap = "wrap";
                } else {
                    if (locate == 2) {
                        wrap = "skip";
                    } else {
                        if (locate == 0) {
                            wrap = "";
                        }
                    }
                }
                jpanelOption[selectedPanel - 1].add(jpaneltemp.getComponent(0), wrap);
                locate++;
            }
            selectedPanel = selectedPanel - 1;

            jPanel3nen.revalidate();
        
    }//GEN-LAST:event_btnMoveUpActionPerformed

    private void btnAddGroupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddGroupActionPerformed
        // TODO add your handling code here:
        CustomDialog dlg = new CustomDialog(new Add_Group(), null, true);
        dlg.show(null);
        separator = new JSeparator();
        separator.setPreferredSize(new Dimension(350, 20));
        hmtaxonomy = (HmTaxonomy) dlg.getFormData();
        groupcount = jPanel3nen.getComponentCount();
        System.out.println("Group count: " + groupcount);
        jpanelGroup[groupcount] = new JPanel(new MigLayout());
        groupName[groupcount] = new JLabel();
        groupName[groupcount].setText(hmtaxonomy.getDescription());
        jpanelGroup[groupcount].setBackground(Color.red);
        if (groupcount == 0) {
            jpanelGroup[groupcount].add(groupName[groupcount], "split2, wrap");
            jpanelGroup[groupcount].revalidate();
            jPanel3nen.add(jpanelGroup[groupcount], "wrap");
            jPanel3nen.repaint();
            jPanel3nen.revalidate();
        } else {
            jpanelGroup[groupcount].add(separator, "wrap, growx");
            jpanelGroup[groupcount].add(groupName[groupcount], "split2, wrap");
            jpanelGroup[groupcount].revalidate();
            jPanel3nen.add(jpanelGroup[groupcount], "wrap");
            jPanel3nen.repaint();
            jPanel3nen.revalidate();
        }
    }//GEN-LAST:event_btnAddGroupActionPerformed

    private void btnMoveDownActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMoveDownActionPerformed
        // TODO add your handling code here:
        int locate;
        String wrap = null;
        jpaneltemp.removeAll();
        locate = 0;
        while (jpanelOption[selectedPanel + 1].getComponentCount() > 0) {
            if (locate == 1 || locate == 3) {
                wrap = "wrap";
            } else {
                if (locate == 2) {
                    wrap = "skip";
                } else {
                    if (locate == 0) {
                        wrap = "";
                    }
                }
            }
            jpaneltemp.add(jpanelOption[selectedPanel + 1].getComponent(0), wrap);
            locate++;
        }

        locate = 0;
        while (jpanelOption[selectedPanel].getComponentCount() > 0) {
            if (locate == 1 || locate == 3) {
                wrap = "wrap";
            } else {
                if (locate == 2) {
                    wrap = "skip";
                } else {
                    if (locate == 0) {
                        wrap = "";
                    }
                }
            }
            jpanelOption[selectedPanel + 1].add(jpanelOption[selectedPanel].getComponent(0), wrap);
            locate++;
        }

        locate = 0;
        while (jpaneltemp.getComponentCount() > 0) {
            if (locate == 1 || locate == 3) {
                wrap = "wrap";
            } else {
                if (locate == 2) {
                    wrap = "skip";
                } else {
                    if (locate == 0) {
                        wrap = "";
                    }
                }
            }
            jpanelOption[selectedPanel].add(jpaneltemp.getComponent(0), wrap);
            locate++;
        }
        selectedPanel = selectedPanel + 1;

        jPanel3nen.revalidate();
    }//GEN-LAST:event_btnMoveDownActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAddField;
    private javax.swing.JButton btnAddGroup;
    private javax.swing.JButton btnMoveDown;
    private javax.swing.JButton btnMoveUp;
    private javax.swing.JButton jButton5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel3nen;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration//GEN-END:variables

    @Override
    public void setFormData(Object objData) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.

    }

    @Override
    public Object getFormData() {
        return null;
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void onLoad() {
//        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    ActionListener jCheckboxactionListener = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            for (int i = 0; i < chkbox.length; i++) {
                for (int j = 0; j < chkbox.length; j++) {

                    if (e.getSource() == chkbox[j][i]) {
                        //[j][i]
                        //[j] = Group
                        //[i] = PanelOption inside of group
                        System.out.println("i= " + i);
                        System.out.println("j= " + j);
                        locateArrayI=i;
                        locateArrayJ=j;
                        selectedPanel=i;
                    }
                }
            }
        }
    };

    public void setControlPanel(int dataType) {
        /**
         * input: groupcount,[0]
         */
        containercount = jPanel3nen.getComponentCount();
        
        try {
            if (groupcount == 0) {
                componentcounter = jpanelGroup[groupcount].getComponentCount()-1;
            } else {
                componentcounter = jpanelGroup[groupcount].getComponentCount()-2;
            }
        } catch (Exception e) {
            System.out.println("shit");
        }
        System.out.println("Component counter: " + componentcounter);
        System.out.println("Container counter: " + containercount);
        chkbox[groupcount][componentcounter] = new JCheckBox();
        chkbox[groupcount][componentcounter].addActionListener(jCheckboxactionListener);
        lb[groupcount][componentcounter] = new JLabel(hmobjectmeta.getDisplayText());
        txtString[groupcount][componentcounter] = new TextField();
        JButton btn = new JButton("X");
        switch (dataType) {
            case 1:
                System.out.println("Group so :" + groupcount);
                jpanelOption[containercount] = new JPanel(new MigLayout());
                //jpanelGroup[groupcount] = new JPanel(new MigLayout());
                txtString[groupcount][componentcounter].setPreferredSize(new Dimension(220, 27));
                jpanelOption[containercount].setLayout(new MigLayout());
                jpanelOption[containercount].add(chkbox[groupcount][componentcounter]);
                jpanelOption[containercount].add(lb[groupcount][componentcounter], "wrap");
                jpanelOption[containercount].add(txtString[groupcount][componentcounter], "skip");
                jpanelOption[containercount].add(btn, "wrap");
                
                jpanelOption[containercount].revalidate();

                jpanelGroup[groupcount].revalidate();
                jpanelGroup[groupcount].add(jpanelOption[containercount], "wrap");
                System.out.println("Tong so component jPanel Option trong Group [" + groupcount + "] " + jpanelGroup[groupcount].getComponentCount() + "");
                jPanel3nen.add(jpanelGroup[groupcount], "wrap");
                jPanel3nen.revalidate();
                break;
            /*
             case 2:
             jpanelOption[containercount] = new JPanel();
             jpanelGroup[groupcount] = new JPanel();
             txtString.setPreferredSize(new Dimension(220, 27));
             jpanelOption[containercount].setLayout(new MigLayout());
             jpanelOption[containercount].add(chk[containercount]);
             jpanelOption[containercount].add(lb, "wrap");
             jpanelOption[containercount].add(txtString, "skip");
             jpanelOption[containercount].add(btn, "wrap");
             jpanelOption[containercount].repaint();
             jpanelOption[containercount].revalidate();
             jpanelGroup[groupcount].add(jpanelOption[containercount], "wrap");
             jPanel3nen.add(jpanelGroup[groupcount], "wrap");
             jPanel3nen.revalidate();
             break;

             case 3:
             jpanelOption[containercount] = new JPanel();
             jpanelGroup[groupcount] = new JPanel();
             txtString.setPreferredSize(new Dimension(220, 27));
             jpanelOption[containercount].setLayout(new MigLayout());
             jpanelOption[containercount].add(chk[containercount]);
             jpanelOption[containercount].add(lb, "wrap");
             jpanelOption[containercount].add(txtString, "skip");
             jpanelOption[containercount].add(btn, "wrap");
             jpanelOption[containercount].repaint();
             jpanelOption[containercount].revalidate();
             jpanelGroup[groupcount].add(jpanelOption[containercount], "wrap");
             jPanel3nen.add(jpanelGroup[groupcount], "wrap");
             jPanel3nen.revalidate();

             break;

             case 4:
             jpanelOption[containercount] = new JPanel();
             jpanelGroup[groupcount] = new JPanel();
             txtString.setPreferredSize(new Dimension(220, 27));
             jpanelOption[containercount].setLayout(new MigLayout());
             jpanelOption[containercount].add(chk[containercount]);
             jpanelOption[containercount].add(lb, "wrap");
             jpanelOption[containercount].add(txtString, "skip");
             jpanelOption[containercount].add(btn, "wrap");
             jpanelOption[containercount].repaint();
             jpanelOption[containercount].revalidate();
             jpanelGroup[groupcount].add(jpanelOption[containercount], "wrap");
             jPanel3nen.add(jpanelGroup[groupcount], "wrap");
             jPanel3nen.revalidate();

             break;

             case 5:
             jpanelOption[containercount] = new JPanel();
             jpanelGroup[groupcount] = new JPanel();
             txtString.setPreferredSize(new Dimension(220, 27));
             jpanelOption[containercount].setLayout(new MigLayout());
             jpanelOption[containercount].add(chk[containercount]);
             jpanelOption[containercount].add(lb, "wrap");
             jpanelOption[containercount].add(txtString, "skip");
             jpanelOption[containercount].add(btn, "wrap");
             jpanelOption[containercount].repaint();
             jpanelOption[containercount].revalidate();
             jpanelGroup[groupcount].add(jpanelOption[containercount], "wrap");
             jPanel3nen.add(jpanelGroup[groupcount], "wrap");
             jPanel3nen.revalidate();
             break;

             case 6:
             JXImageView imagebox = new org.jdesktop.swingx.JXImageView();
             imagebox.setPreferredSize(new Dimension(220, 220));
             JButton btnAddImage = new JButton("No Image");
             jpanelGroup[groupcount] = new JPanel();
             jpanelOption[containercount].setLayout(new MigLayout());
             jpanelOption[containercount].add(chk[containercount]);
             jpanelOption[containercount].add(lb, "wrap");
             jpanelOption[containercount].add(imagebox, "skip");
             jpanelOption[containercount].add(btn, "wrap");
             jpanelOption[containercount].repaint();
             jpanelOption[containercount].revalidate();
             jpanelGroup[groupcount].add(jpanelOption[containercount], "wrap");
             jPanel3nen.add(jpanelGroup[groupcount], "wrap");
             jPanel3nen.revalidate();
             break;

             case 7:
             jpanelOption[containercount] = new JPanel();
             jpanelGroup[groupcount] = new JPanel();
             txtString.setPreferredSize(new Dimension(220, 27));
             jpanelOption[containercount].setLayout(new MigLayout());
             jpanelOption[containercount].add(chk[containercount]);
             jpanelOption[containercount].add(lb, "wrap");
             jpanelOption[containercount].add(txtString, "skip");
             jpanelOption[containercount].add(btn, "wrap");
             jpanelOption[containercount].repaint();
             jpanelOption[containercount].revalidate();
             jpanelGroup[groupcount].add(jpanelOption[containercount], "wrap");
             jPanel3nen.add(jpanelGroup[groupcount], "wrap");
             jPanel3nen.revalidate();
             break;

             case 8:
             jpanelOption[containercount] = new JPanel();
             jpanelGroup[groupcount] = new JPanel();
             txtString.setPreferredSize(new Dimension(220, 27));
             jpanelOption[containercount].setLayout(new MigLayout());
             jpanelOption[containercount].add(chk[containercount]);
             jpanelOption[containercount].add(lb, "wrap");
             jpanelOption[containercount].add(txtString, "skip");
             jpanelOption[containercount].add(btn, "wrap");
             jpanelOption[containercount].repaint();
             jpanelOption[containercount].revalidate();
             jpanelGroup[groupcount].add(jpanelOption[containercount], "wrap");
             jPanel3nen.add(jpanelGroup[groupcount], "wrap");
             jPanel3nen.revalidate();
             break;

             case 9:
             JComboBox cbx = new JComboBox();
             jpanelGroup[groupcount] = new JPanel();
             cbx.setPreferredSize(new Dimension(220, 27));
             jpanelOption[containercount].setLayout(new MigLayout());
             jpanelOption[containercount].add(chk[containercount]);
             jpanelOption[containercount].add(lb, "wrap");
             jpanelOption[containercount].add(cbx, "skip");
             jpanelOption[containercount].add(btn, "wrap");
             jpanelOption[containercount].repaint();
             jpanelOption[containercount].revalidate();
             jpanelGroup[groupcount].add(jpanelOption[containercount], "wrap");
             jPanel3nen.add(jpanelGroup[groupcount], "wrap");
             jPanel3nen.revalidate();
             break;

             case 10:
             JCheckBox chkbox = new JCheckBox();
             jpanelGroup[groupcount] = new JPanel();
             chkbox.setPreferredSize(new Dimension(220, 27));
             jpanelOption[containercount].setLayout(new MigLayout());
             jpanelOption[containercount].add(chk[containercount]);
             jpanelOption[containercount].add(lb, "wrap");
             jpanelOption[containercount].add(chkbox, "skip");
             jpanelOption[containercount].add(btn, "wrap");
             jpanelOption[containercount].repaint();
             jpanelOption[containercount].revalidate();
             jpanelGroup[groupcount].add(jpanelOption[containercount], "wrap");
             jPanel3nen.add(jpanelGroup[groupcount], "wrap");
             jPanel3nen.revalidate();
             break;

             case 11:
             jpanelOption[containercount] = new JPanel();
             jpanelGroup[groupcount] = new JPanel();
             txtString.setPreferredSize(new Dimension(220, 27));
             jpanelOption[containercount].setLayout(new MigLayout());
             jpanelOption[containercount].add(chk[containercount]);
             jpanelOption[containercount].add(lb, "wrap");
             jpanelOption[containercount].add(txtString, "skip");
             jpanelOption[containercount].add(btn, "wrap");
             jpanelOption[containercount].repaint();
             jpanelOption[containercount].revalidate();
             jpanelGroup[groupcount].add(jpanelOption[containercount], "wrap");
             jPanel3nen.add(jpanelGroup[groupcount], "wrap");
             jPanel3nen.revalidate();
             break;
             */
            default:
        }
    }
}
